
package com.group8.ui;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.group8.gm.GameController;
import com.group8.gm.ScreenManager;

public class Menu extends JPanel {
	//Attributes
	private static JFrame frame;
	private JPanel currPanel;
	protected static GameController gc;
	private ScreenManager sm;
	private static SettingsPanel settingsP;
	private static HelpPanel helpP;
	private static HighScorePanel hiScoreP;
	private static CreditsPanel creditsP;
	private static MainMenu mainM;
	// End Attributes
	public Menu(){
		
	}
	public static void main(String[] args) {
		
		
		Menu menu;
		
		frame = new JFrame("HopTops");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setVisible(true);
		frame.pack();
		System.out.println("Welcome to Hop Tops");
		menu = new Menu();
		mainM = new MainMenu();
		menu.switchPanels(mainM);
		
	}
	public void setGC(GameController g){
		gc = g;
	}
	public GameController getGC(){
		return gc;
	}
	public void setHighS(HighScorePanel hsp){
		hiScoreP = hsp;
	}
	public void setSettingsP(SettingsPanel sp){
		settingsP = sp;
	}
	public void setHelpP(HelpPanel hp){
		helpP = hp;
	}
	public void setCreditsP(CreditsPanel cp){
		creditsP = cp;
	}
	public void changeSoundState(boolean music, boolean fx){
		//Use gamecontroller to change sounds.
	}
	public JPanel getMain(){
		return mainM;
	}
	// Methods
	public void switchPanels(JPanel newPanel) {
		frame.getContentPane().removeAll();
		currPanel = newPanel;
		displayCurr(currPanel);
		
	}
	
	public boolean displayCurr(JPanel currPanel) {
		//frame.getContentPane().removeAll();
		frame.getContentPane().add(currPanel);
		frame.repaint();
		frame.revalidate();
		frame.pack();
		return false;
	}
	
	// End of methods
}